#include<iostream>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
void B(int size,int x,int y,auto &img){
  if(size==1){
    img[x][y]='X';
    return;
  }
  int once=size/3;
  int twice=once*2;
  B(once,x,y,img);
  B(once,x+twice,y,img);
  B(once,x,y+twice,img);
  B(once,x+once,y+once,img);
  B(once,x+twice,y+twice,img);
}
int main(){
  int n;
  while(cin>>n){
    if(n==-1) break;
    int size=pow(3,n-1);
    auto img=vector(size,string(size,' '));
    B(size,0,0,img);
    for(auto &x:img){
      cout<<x<<endl;
    }
    cout<<'-'<<endl;
  }

}